/*
 * @Author: Wang Yang
 * @Date: 2021-06-01 18:51:56
 * @LastEditors: Wang Yang
 * @LastEditTime: 2021-06-02 10:19:19
 * @Description: 状态管理
 */

const defaultState = {
  count: 0,
  token: ""
};

export default {
  state() {
    return defaultState;
  },
  mutations: {
    SET_INCREMENT(state) {
      state.count++;
    }
  },
  actions: {
    increment(context) {
      context.commit("SET_INCREMENT");
    }
  },
  getters: {
    double(state) {
      return 2 * state.count;
    }
  }
};
